/* Essential Model Documentation - Custom Styles for shadcn theme */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&family=Noto+Sans:wght@400;500;600;700&display=swap');


@font-face {
  font-family: Virgil; /* set name */
  src: url(../assets/Virgil.woff2); /* relative to stylesheets/custom.css */
}

svg text, 
svg [font-family*="Virgil"] {
  font-family: Virgil, sans-serif !important;
}

/* SVG text elements should never intercept clicks — let them pass through to
   the underlying <a> / <rect> elements that carry the actual href. */
svg text,
svg tspan {
  pointer-events: none;
}
/* ============================================
   CSS VARIABLES - BLUE THEME
   ============================================ */



:root {
  --emd-primary: #2196f3;
  --emd-primary-light: #bbdefb;
  --emd-primary-dark: #1976d2;
  --emd-accent: #2196f3;
  --emd-text: #1e293b;
  --emd-text-secondary: #475569;
  --emd-text-tertiary: #94a3b8;
  --emd-bg: #ffffff;
  --emd-bg-secondary: #f8fafc;
  --emd-bg-tertiary: #f1f5f9;
  --emd-border: #e2e8f0;
  --emd-border-light: #f1f5f9;
  
  color: var(--emd-text);
}

.dark {
  /* Backgrounds — true slate, no blue tint */
  --emd-bg:           #1a1d20;
  --emd-bg-secondary: #22262b;
  --emd-bg-tertiary:  #2b3038;

  /* Borders — visible but not harsh */
  --emd-border:       #3a4048;
  --emd-border-light: #2b3038;

  /* Text — high contrast white/light-grey hierarchy */
  --emd-text:           #f0f2f4;
  --emd-text-secondary: #c8cdd4;
  --emd-text-tertiary:  #7e8894;

  /* Accent — lighter sky blue that pops on dark slate */
  --emd-primary:      #60a5fa;
  --emd-primary-light: rgba(96, 165, 250, 0.15);
  --emd-primary-dark: #93c5fd;

  color: var(--emd-text);

  /* shadcn theme token overrides */
  --primary: 213 94% 68%;
  --primary-foreground: 220 13% 10%;
  --accent: 213 94% 68%;
  --accent-foreground: 220 13% 10%;
  --sidebar-primary: 213 94% 68%;
  --sidebar-primary-foreground: 220 13% 10%;
  --ring: 213 70% 60%;
  --background: 220 10% 11%;
  --foreground: 213 10% 95%;
  --card: 220 10% 13%;
  --card-foreground: 213 10% 95%;
  --muted: 220 9% 17%;
  --muted-foreground: 213 8% 55%;
  --border: 220 8% 23%;
}

/* ============================================
   HIDE DEFAULT THEME ELEMENTS
   ============================================ */

/* Hide shadcn theme's default GitHub link */
header a[target="_blank"]:not(.header-repo):has(svg[viewBox="0 0 438.549 438.549"]),
header a[href*="github.com"][target="_blank"]:not(.header-repo) {
  display: none !important;
}

/* Hide Copy Page button */
button[onclick*="clipboard"],
button:has(.tabler-icon-copy) {
  display: none !important;
}

/* ============================================
   HEADER
   ============================================ */

header {
  background: var(--emd-bg) !important;
  border-bottom: 1px solid var(--emd-border) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: relative;
}

/* Logo and home link SVGs */
header a[href="/"] svg,
header a[href="./"] svg,
header [data-slot="logo"] svg,
[data-slot="sidebar"] a[href="/"] svg,
[data-slot="sidebar"] a[href="./"] svg,
[data-slot="sidebar"] [data-slot="logo"] svg {
  stroke: var(--emd-primary) !important;
  fill: none !important;
  color: var(--emd-primary) !important;
}

/* Header SVGs and icons - primary stroke */
header svg {
  stroke: var(--emd-primary) !important;
  color: var(--emd-primary) !important;
}

/* Header buttons */
header button svg {
  fill: none !important;
  stroke: var(--emd-primary) !important;
}

header h1,
header [data-slot="title"] {
  font-family: "Noto Sans", var(--font-sans), system-ui;
  font-weight: 700 !important;
  color: var(--emd-primary-dark) !important;
  font-size: 0.95rem !important;
}

/* GitHub repo link in title */
.header-repo {
  color: var(--emd-text) !important;
  text-decoration: none;
  font-family: "Noto Sans", var(--font-sans), system-ui;
  font-weight: 400;
  font-size: 1.1rem;
  transition: color 0.2s, opacity 0.2s;
}

.header-repo:hover {
  color: var(--emd-text-secondary) !important;
  opacity: 0.8;
}

/* Search styling */
header input[type="search"],
header [data-slot="input"] {
  background: white !important;
  border: 1px solid var(--emd-border) !important;
  border-radius: 4px !important;
  outline: none !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

header input[type="search"]:focus,
header [data-slot="input"]:focus {
  border-color: var(--emd-primary) !important;
  box-shadow: 0 0 0 3px rgba(var(--emd-primary-rgb), 0.15) !important;
}

header input[type="search"]::placeholder {
  opacity: 0.6;
}

/* Search dialog trigger button - override Tailwind focus ring */
button[data-slot="dialog-trigger"] {
  border: 1px solid var(--emd-border) !important;
}

button[data-slot="dialog-trigger"] kbd {
  border-color: var(--emd-primary) !important;
}

button[data-slot="dialog-trigger"]:hover {
  border-color: var(--emd-primary) !important;
  background: var(--emd-bg-secondary) !important;
}

button[data-slot="dialog-trigger"]:focus,
button[data-slot="dialog-trigger"]:focus-visible,
button[data-slot="dialog-trigger"]:focus-within {
  border-color: var(--emd-primary) !important;
  outline: 3px solid rgba(var(--emd-primary-rgb), 0.3) !important;
  outline-offset: 0 !important;
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */

/* Sidebar container - full height */
[data-slot="sidebar"] {
  min-height: 100vh !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
}

[data-slot="sidebar"] > * {
  flex-shrink: 0;
}

/* Sidebar icons and SVGs */
[data-slot="sidebar"] svg,
[data-slot="sidebar-menu"] svg,
[data-slot="sidebar-menu-item"] svg {
  color: var(--emd-primary);
  stroke: var(--emd-primary);
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

/* Active menu item icons - white */
[data-slot="sidebar-menu-item"] a[data-active="true"] svg,
[data-slot="sidebar-menu-button"][data-active="true"] svg {
  color: white;
  stroke: white;
}

/* Sidebar menu items - allow text to wrap and center vertically */
[data-slot="sidebar-menu-button"],
[data-slot="sidebar-menu"] a,
.sidebar-menu-button,
nav a {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: unset !important;
  height: auto !important;
  min-height: 1.5rem;
  line-height: 1.2 !important;
  display: flex !important;
  align-items: center !important;
}

/* Items inside groups/dropdowns - smaller, indented, tighter spacing */
[data-slot="sidebar-group-content"] [data-slot="sidebar-menu-item"],
[data-slot="sidebar-group-content"] a,
.nav-children a {
  margin: 0 !important;
  padding: 0.15rem 0.5rem 0.15rem 1rem !important;
  font-size: 0.75rem !important;
  min-height: 1.25rem !important;
}

[data-slot="sidebar-group-content"] [data-slot="sidebar-menu-item"] {
  margin: 0 !important;
  padding: 0 !important;
}

[data-slot="sidebar-group-content"] ul {
  gap: 0 !important;
}

/* Strip ALL background colours from sidebar buttons — hover, active, focus, any state */
[data-slot="sidebar-menu-button"],
[data-slot="sidebar-menu-button"]:hover,
[data-slot="sidebar-menu-button"]:active,
[data-slot="sidebar-menu-button"]:focus,
[data-slot="sidebar-menu-button"]:focus-visible {
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
}

/* Remove theme gradient overlays from the sidebar */
.bg-gradient-to-b {
  background-image: none !important;
  background: transparent !important;
  backdrop-filter: none !important;
}

/* ============================================
   ACTIVE SIDEBAR ITEM — clean colour + underline only
   ============================================ */

/* Strip the background pill, border, and pseudo-element shape */
[data-slot="sidebar-menu-button"][data-active="true"],
[data-slot="sidebar-menu-button"][data-active="true"]:hover,
[data-active="true"] {
  background: transparent !important;
  background-color: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

/* Also kill the ::after pseudo-element the theme uses for the rounded pill */
[data-slot="sidebar-menu-button"][data-active="true"]::after,
[data-active="true"]::after {
  display: none !important;
  background: transparent !important;
}

/* Colour change + underline on the text */
[data-active="true"],
[data-active="true"] span,
[data-active="true"] a {
  color: var(--emd-primary) !important;
  text-decoration: underline !important;
  text-underline-offset: 3px !important;
  font-weight: 600 !important;
}

/* Reduce vertical spacing between nav items */
[data-slot="sidebar-menu"] > *,
[data-slot="sidebar-group-content"] > *,
.nav-children > * {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

[data-slot="sidebar-menu-item"],
[data-slot="sidebar-group"] {
  margin: 0 !important;
  padding: 0 !important;
}

/* Tighter spacing for dropdown items */
[data-slot="sidebar-group-content"] a,
.nav-children a {
  margin: 0 !important;
  font-size: 0.8rem !important;
}

/* Group labels (section headers) */
[data-slot="sidebar-group-label"] {
  padding: 0.4rem 0.5rem !important;
  margin-top: 0.5rem !important;
  margin-bottom: 0 !important;
}

/* First group label doesn't need top margin */
[data-slot="sidebar-group"]:first-child [data-slot="sidebar-group-label"] {
  margin-top: 0 !important;
}

/* ============================================
   COLLAPSIBLE NAVIGATION
   ============================================ */

/* Collapsible triggers */
.nav-collapsible,
[data-slot="sidebar-group-label"].nav-collapsible {
  cursor: pointer;
  position: relative;
}

.nav-collapsible::before,
[data-slot="sidebar-group-label"].nav-collapsible::before {
  content: "";
  display: inline-block;
  margin-right: 0.4rem;
  font-size: 0.7rem;
  opacity: 0.6;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.nav-collapsible.expanded::before,
[data-slot="sidebar-group-label"].expanded::before {
  transform: rotate(90deg);
}

/* Default: content after a label is COLLAPSED */
[data-slot="sidebar-group-label"] + [data-slot="sidebar-group-content"] {
  overflow: hidden;
  max-height: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: max-height 0.3s ease-out, opacity 0.2s ease;
}

/* Expanded: when label has .expanded class */
[data-slot="sidebar-group-label"].expanded + [data-slot="sidebar-group-content"] {
  max-height: 2000px !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Root groups (no label) - always visible */
[data-slot="sidebar-group"]:not(:has([data-slot="sidebar-group-label"])) [data-slot="sidebar-group-content"] {
  max-height: none !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  display: block !important;
}

/* Ensure all sidebar groups are always visible on all pages */
[data-slot="sidebar-group"] {
  display: block !important;
  visibility: visible !important;
}

[data-slot="sidebar-group-label"] {
  display: flex !important;
  visibility: visible !important;
}

/* ============================================
   CUSTOM LINKS SECTION
   ============================================ */

.custom-links-section {
  margin-top: 1rem !important;
  padding-top: 0.5rem !important;
  border-top: 1px solid var(--emd-border-light) !important;
  display: block !important;
}

.custom-links-list {
  display: block !important;
}

.custom-links-title {
  font-family: "Noto Sans", var(--font-sans), system-ui !important;
  font-size: 0.55rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  color: var(--emd-text-tertiary) !important;
  padding: 0.5rem 0.6rem 0.3rem !important;
}

.custom-link {
  display: block !important;
  font-size: 0.75rem !important;
  color: var(--emd-text-secondary) !important;
  padding: 0.3rem 0.6rem !important;
  margin: 1px 0.4rem !important;
  border-radius: 4px !important;
  text-decoration: none !important;
  transition: all 0.15s ease !important;
}

.custom-link:hover {
  background: var(--emd-bg-secondary) !important;
  color: var(--emd-text) !important;
}

/* ============================================
   CONTENT AREA
   ============================================ */

main, article {
  background: var(--emd-bg) !important;
}

/* Admonition icons */
.admonition-title svg {
  color: currentColor;
}

/* Lucide and other icon libraries */
.lucide, [data-lucide] {
  color: currentColor;
  stroke: currentColor;
}

/* Material icons */
.material-icons, .md-icon {
  color: currentColor;
}

/* ============================================
   DETAILS / SUMMARY (Collapsible sections)
   ============================================ */

/*
 * NOTE: For markdown to render inside <details> tags, use either:
 * 1. <details markdown="1"> attribute
 * 2. pymdownx.details syntax: ??? note "Title"
 */

details {
  border: 1px solid var(--emd-border);
  border-radius: 6px;
  padding: 0;
  margin: 1rem 0;
  background: var(--emd-bg);
}

details summary {
  color: var(--emd-primary-dark);
  font-weight: 600;
  cursor: pointer;
  padding: 0.5rem 1rem;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  background: var(--emd-bg-secondary);
  border-radius: 6px;
}

details[open] summary {
  border-radius: 6px 6px 0 0;
  border-bottom: 1px solid var(--emd-border);
}

details summary::-webkit-details-marker {
  display: none;
}

details summary::after {
  content: "";
  color: var(--emd-primary-dark);
  font-size: 0.75rem;
  transition: transform 0.2s ease;
  margin-left: 0.5rem;
}

details[open] summary::after {
  transform: rotate(90deg);
}

details summary:hover {
  background: var(--emd-bg-tertiary);
}

/* Details content container */
details > *:not(summary) {
  padding: 0 1rem;
}

details > p,
details > ul,
details > ol,
details > pre,
details > blockquote,
details > table,
details > div {
  margin: 0.5rem 0;
}

details > *:last-child {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
}

/* Typography inheritance for details content */
details .typography,
details .prose,
details article {
  max-width: 100% !important;
  padding: 0 !important;
}

/* Ensure code blocks in details are styled */
details pre {
  background: var(--emd-bg-secondary) !important;
  border: 1px solid var(--emd-border);
  border-radius: 4px;
  padding: 0.75rem;
  overflow-x: auto;
  margin: 0.5rem 1rem;
}

details code {
  background: var(--emd-bg-secondary);
  padding: 0.15rem 0.3rem;
  border-radius: 3px;
  font-size: 0.875em;
}

details pre code {
  background: transparent;
  padding: 0;
}

/* Lists in details */
details ul,
details ol {
  padding-left: 1.5rem;
  margin-left: 1rem;
}

details li {
  margin: 0.25rem 0;
}

/* Raw text content - white-space handling for unprocessed content */
details > br + br {
  display: block;
  content: "";
  margin: 0.5rem 0;
}

/* Headings in details */
details h1, details h2, details h3, details h4, details h5, details h6 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: var(--emd-text);
}

details h1 { font-size: 1.5rem; }
details h2 { font-size: 1.25rem; }
details h3 { font-size: 1.1rem; }
details h4, details h5, details h6 { font-size: 1rem; }

/* JS-processed details content */
.details-content {
  line-height: 1.6;
}

.details-content p {
  margin: 0.5rem 0;
}

.details-content ul,
.details-content ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.details-content li {
  margin: 0.25rem 0;
}

.details-content a {
  color: var(--emd-primary);
  text-decoration: underline;
}

.details-content code {
  background: var(--emd-bg-secondary);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.875em;
}

/* Override Tailwind typography/prose max-width (default is 65ch  672px) */
.typography {
  max-width: 1200px !important;
  padding: 0 2rem !important;
}

/* Also target common prose classes */
.prose {
  max-width: 1200px !important;
  padding: 0 2rem !important;
}

/* Ensure article itself can expand */
article.w-full {
  max-width: 1200px !important;
  padding: 0 1rem !important;
}

/* Headers as full anchor links */
article h1,
article h2,
article h3,
article h4,
article h5,
article h6 {
  position: relative;
}

article h1 a.anchor,
article h2 a.anchor,
article h3 a.anchor,
article h4 a.anchor,
article h5 a.anchor,
article h6 a.anchor,
article h1 a[href^="#"],
article h2 a[href^="#"],
article h3 a[href^="#"],
article h4 a[href^="#"],
article h5 a[href^="#"],
article h6 a[href^="#"] {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  color: inherit !important;
  text-decoration: none !important;
}

/* Hide the permalink symbol */
article h1 a.anchor::after,
article h2 a.anchor::after,
article h3 a.anchor::after,
article h4 a.anchor::after,
article h5 a.anchor::after,
article h6 a.anchor::after,
article .headerlink,
article .anchor-link,
article [href^="#"]::after,
a.headerlink {
  display: none !important;
  content: none !important;
  visibility: hidden !important;
}

/* Permalink character hidden */
article h1 a[href^="#"]:not(:only-child),
article h2 a[href^="#"]:not(:only-child),
article h3 a[href^="#"]:not(:only-child),
article h4 a[href^="#"]:not(:only-child),
article h5 a[href^="#"]:not(:only-child),
article h6 a[href^="#"]:not(:only-child) {
  font-size: 0;
}

/* But keep the header text visible */
article h1 a[href^="#"]:not(:only-child)::before,
article h2 a[href^="#"]:not(:only-child)::before,
article h3 a[href^="#"]:not(:only-child)::before {
  font-size: 1rem;
}

/* Header hover effect */
article h1:hover,
article h2:hover,
article h3:hover,
article h4:hover,
article h5:hover,
article h6:hover {
  cursor: pointer;
}

article h1 {
  font-family: "Noto Sans", var(--font-sans), system-ui !important;
  font-size: 2rem !important;
  font-weight: 700 !important;
  color: var(--emd-text) !important;
  border-bottom: 1px solid var(--emd-border-light) !important;
  padding-bottom: 0.5rem !important;
  margin-bottom: 1.5rem !important;
}

article h2 {
  font-family: "Noto Sans", var(--font-sans), system-ui !important;
  font-size: 1.4rem !important;
  font-weight: 600 !important;
  color: var(--emd-text) !important;
  border-bottom: 1px solid var(--emd-border-light) !important;
  padding-bottom: 0.4rem !important;
  margin-top: 2rem !important;
}

article h3 {
  font-family: "Noto Sans", var(--font-sans), system-ui !important;
  font-size: 1.1rem !important;
  font-weight: 600 !important;
  color: var(--emd-text) !important;
}

article h4 {
  font-family: "Noto Sans", var(--font-sans), system-ui !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  color: var(--emd-text) !important;
}

article p {
  color: var(--emd-text-secondary) !important;
  line-height: 1.7 !important;
}

article a {
  color: var(--emd-primary) !important;
  text-decoration: none !important;
}

article a:hover {
  color: var(--emd-primary-dark) !important;
  text-decoration: underline !important;
}

/* Code */
article code {
  font-family: "JetBrains Mono", monospace !important;
  font-size: 0.8rem !important;
  background: var(--emd-bg-tertiary) !important;
  border: 1px solid var(--emd-border) !important;
  border-radius: 4px !important;
  padding: 0.15em 0.4em !important;
}

article pre {
  background: var(--emd-bg-secondary) !important;
  border: 1px solid var(--emd-border) !important;
  border-radius: 8px !important;
}

article pre code {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}

/* Tables */
article table {
  border: 1px solid var(--emd-border) !important;
  border-radius: 8px !important;
  overflow: hidden !important;
}

article table a {
  color: var(--emd-primary) !important;
}

article thead {
}

article th {
  background: var(--emd-bg-secondary) !important;
  font-family: "Noto Sans", var(--font-sans), system-ui !important;
  font-weight: 600 !important;
  font-size: 0.7rem !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
}

article tr:hover td {
  background: var(--emd-bg-secondary) !important;
}

/* ============================================
   FOOTER - MATERIAL STYLE PREV/NEXT NAVIGATION
   ============================================ */

/* Hide shadcn's default footer */
body > div > footer {
  display: none !important;
}

/* Our Material-style footer */
.md-footer {
  background: transparent;
  margin-top: 3rem;
  padding: 0 1rem;
}

.md-footer__inner {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--emd-border-light);
  padding: 1rem 0;
}

.md-footer__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--emd-primary);
  text-decoration: none;
  transition: color 0.2s;
}

.md-footer__link:hover {
  color: var(--emd-primary-dark);
}

.md-footer__link--prev {
  margin-right: auto;
}

.md-footer__link--next {
  margin-left: auto;
  flex-direction: row-reverse;
}

.md-footer__link--next .md-footer__title {
  text-align: right;
}

.md-footer__button {
  display: flex;
  align-items: center;
  justify-center: center;
  color: var(--emd-primary);
}

.md-footer__button svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: currentColor;
}

.md-footer__title {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.md-footer__direction {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--emd-text-tertiary);
}

.md-ellipsis {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--emd-primary);
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================
   COPYRIGHT FOOTER - FIXED AT BOTTOM
   ============================================ */

.footer-attribution {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  pointer-events: none !important;
  z-index: 1000 !important;
  background: transparent !important;
  padding: 0.5rem 1rem !important;
  text-align: center !important;
  border-top: none !important;
}

.footer-attribution p {
  font-size: 0.5rem !important;
  color: var(--emd-text-tertiary) !important;
  margin: 0 !important;
  opacity: 0.7 !important;
}

.footer-attribution a {
  color: var(--emd-primary) !important;
  text-decoration: none !important;
  pointer-events: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  display: inline !important;
  font-size: inherit !important;
}

.footer-attribution a:hover {
  text-decoration: underline !important;
}

/* Footer attribution handled in HIDE DEFAULT THEME ELEMENTS section */

/* ============================================
   VERSION SELECTOR
   ============================================ */

.version-selector {
  display: flex;
  align-items: center;
}

.version-selector select {
  appearance: auto;
  background: var(--emd-bg);
  border: 1px solid var(--emd-border);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  color: var(--emd-text);
}

.version-selector select:hover {
  background: var(--emd-bg-secondary);
}

/* ============================================
   TOC - RIGHT SIDEBAR
   ============================================ */

[view-transition-name="toc"] a,
.toc a {
  font-size: 0.7rem !important;
  color: var(--emd-text-tertiary) !important;
  padding: 0.25rem 0.6rem !important;
  margin: 1px 0.3rem !important;
}

[view-transition-name="toc"] a:hover,
.toc a:hover {
  color: var(--emd-primary) !important;
}

/* ============================================
   SCROLLBAR
   ============================================ */

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--emd-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--emd-text-tertiary); }

/* ============================================
   SELECTION
   ============================================ */

::selection {
  background: var(--emd-primary-light);
  color: var(--emd-primary);
}

/* ============================================
   PRINT
   ============================================ */

@media print {
  [data-slot="sidebar"], aside, .footer-attribution, .version-selector {
    display: none !important;
  }
  main, article { max-width: 100% !important; }
}

/* ============================================
   EMBED MODE STYLES
   ============================================ */

/* Floating expand button */
.floating-expand-btn {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: var(--emd-primary, #3b82f6);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.floating-expand-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* Embed mode body state */
body.embed-mode {
  overflow-x: hidden;
}

body.embed-mode header,
body.embed-mode [data-slot="sidebar"],
body.embed-mode aside,
body.embed-mode nav:not(.table-nav),
body.embed-mode .footer-attribution,
body.embed-mode [view-transition-name="toc"] {
  display: none !important;
}

body.embed-mode main {
  max-width: 100% !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 15px !important;
}

body.embed-mode article {
  max-width: 100% !important;
  width: 100% !important;
  margin: 5px !important;
  padding: 0 !important;
}

body.embed-mode .typography {
  max-width: 100% !important;
  padding: 0 !important;
}

/* Tables expand more in embed mode */
body.embed-mode table {
  width: 100% !important;
  max-width: 100% !important;
}

body.embed-mode .table-responsive {
  max-width: 100% !important;
}

/* Table controls */
.table-controls {
  display: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

body.embed-mode .table-controls {
  display: flex !important;
}

.table-search {
  padding: 8px 12px;
  border: 1px solid var(--emd-border, #e2e8f0);
  border-radius: 6px;
  font-size: 0.875rem;
  width: 250px;
  max-width: 100%;
  background: var(--emd-bg, white);
  color: var(--emd-text, #1e293b);
}

.table-search:focus {
  outline: none;
  border-color: var(--emd-primary, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.table-expand-btn {
  padding: 8px 12px;
  border: 1px solid var(--emd-border, #e2e8f0);
  border-radius: 6px;
  background: var(--emd-bg-secondary, #f8fafc);
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}

.table-expand-btn:hover {
  background: var(--emd-bg-tertiary, #f1f5f9);
}

/* Table responsive wrapper */
.table-responsive {
  overflow-x: auto;
  max-width: 100%;
  margin-bottom: 1rem;
}

/* Sort indicators */
th[data-sort="asc"] .sort-indicator,
th[data-sort="desc"] .sort-indicator {
  opacity: 1 !important;
  color: var(--emd-primary) !important;
}

/* Embed mode overlay */
.embed-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--emd-bg, white);
  z-index: 10000;
  overflow: auto;
  padding: 0;
}

.embed-overlay article {
  max-width: 100% !important;
  width: 100% !important;
}

.embed-overlay .typography {
  max-width: 100% !important;
  padding: 0 !important;
}

.embed-overlay .table-wrapper,
.embed-overlay table {
  width: 100% !important;
  max-width: 100% !important;
}

.dark .embed-overlay {
  background: var(--emd-bg, #0f172a);
}

/* Table fullscreen overlay */
.table-fullscreen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--emd-bg, white);
  z-index: 10000;
  overflow: auto;
  padding: 10px;
}

.table-fullscreen-overlay table {
  width: 100% !important;
  max-width: 100% !important;
  table-layout: auto !important;
  border: 1px solid var(--emd-border) !important;
  border-radius: 8px !important;
  border-collapse: collapse !important;
}

.table-fullscreen-overlay th {
  background: var(--emd-bg-secondary) !important;
  font-weight: 600 !important;
  font-size: 0.75rem !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  padding: 0.75rem 1rem !important;
  text-align: left !important;
  border-bottom: 1px solid var(--emd-border) !important;
  cursor: pointer;
}

.table-fullscreen-overlay td {
  padding: 0.75rem 1rem !important;
  border-bottom: 1px solid var(--emd-border) !important;
  white-space: normal !important;
  word-wrap: break-word !important;
}

.table-fullscreen-overlay tr:hover td {
  background: var(--emd-bg-secondary) !important;
}

.table-fullscreen-overlay a {
  color: var(--emd-primary) !important;
}

.dark .table-fullscreen-overlay {
  background: var(--emd-bg, #0f172a);
}

/* ============================================
   TABLE FOOTER WITH DOWNLOAD BUTTON
   ============================================ */

.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  padding: 0.25rem 0;
  font-size: 0.85rem;
  color: var(--emd-text-secondary);
}

.table-footer span {
  font-style: italic;
}

.table-footer-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.table-footer-search {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid var(--emd-primary) !important;
  border-radius: 4px;
  background: var(--emd-bg);
  color: var(--emd-text);
  width: 150px;
  outline: none;
}

.table-footer-search:focus {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.table-footer-search::placeholder {
  color: var(--emd-text-secondary);
  opacity: 0.7;
}

.table-footer-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  color: var(--emd-primary) !important;
  background: var(--emd-bg-secondary);
  border: 1px solid var(--emd-primary) !important;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.table-footer-expand:hover {
  background: var(--emd-primary-light);
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--emd-primary) !important;
  background: var(--emd-bg-secondary);
  border: 1px solid var(--emd-border);
  border-radius: 4px;
  text-decoration: none !important;
  transition: all 0.2s ease;
}

.download-btn:hover {
  background: var(--emd-primary-light);
  border-color: var(--emd-primary);
  text-decoration: none !important;
}

/* ============================================
   MATERIAL FOR MKDOCS TABBED CONTENT
   ============================================ */

/* Hide the radio buttons */
.tabbed-set > input[type="radio"] {
  display: none !important;
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Tab labels container */
.tabbed-labels {
  display: flex;
  gap: 0.125rem;
  border-bottom: 1px solid var(--emd-border);
  margin-bottom: 0.5rem;
  background: transparent;
}

/* Individual tab labels */
.tabbed-labels > label {
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--emd-text-secondary);
  background: transparent;
  transition: all 0.15s ease;
  user-select: none;
}

.tabbed-labels > label:hover {
  color: var(--emd-primary);
  background: transparent;
}

/* Active tab label - using ID selectors for specificity */
#__tabbed_1_1:checked ~ .tabbed-labels > label[for="__tabbed_1_1"],
#__tabbed_1_2:checked ~ .tabbed-labels > label[for="__tabbed_1_2"],
#__tabbed_1_3:checked ~ .tabbed-labels > label[for="__tabbed_1_3"],
#__tabbed_2_1:checked ~ .tabbed-labels > label[for="__tabbed_2_1"],
#__tabbed_2_2:checked ~ .tabbed-labels > label[for="__tabbed_2_2"],
#__tabbed_2_3:checked ~ .tabbed-labels > label[for="__tabbed_2_3"],
#__tabbed_2_4:checked ~ .tabbed-labels > label[for="__tabbed_2_4"],
#__tabbed_2_5:checked ~ .tabbed-labels > label[for="__tabbed_2_5"],
.tabbed-labels > label[data-active="true"] {
  color: var(--emd-primary) !important;
  border-bottom-color: var(--emd-primary) !important;
  background: transparent !important;
}

/* Hide all tab content by default */
.tabbed-set .tabbed-content .tabbed-block {
  display: none !important;
}

/* Show first tab content when first radio is checked */
#__tabbed_1_1:checked ~ .tabbed-content > .tabbed-block:nth-child(1),
#__tabbed_2_1:checked ~ .tabbed-content > .tabbed-block:nth-child(1) {
  display: block !important;
}

/* Show second tab content when second radio is checked */
#__tabbed_1_2:checked ~ .tabbed-content > .tabbed-block:nth-child(2),
#__tabbed_2_2:checked ~ .tabbed-content > .tabbed-block:nth-child(2) {
  display: block !important;
}

/* Show third tab content when third radio is checked */
#__tabbed_1_3:checked ~ .tabbed-content > .tabbed-block:nth-child(3),
#__tabbed_2_3:checked ~ .tabbed-content > .tabbed-block:nth-child(3) {
  display: block !important;
}

/* Show fourth tab content when fourth radio is checked */
#__tabbed_2_4:checked ~ .tabbed-content > .tabbed-block:nth-child(4) {
  display: block !important;
}

/* Show fifth tab content when fifth radio is checked */
#__tabbed_2_5:checked ~ .tabbed-content > .tabbed-block:nth-child(5) {
  display: block !important;
}

/* Content styling */
.tabbed-content {
  padding: 0;
}

.tabbed-block {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Code blocks inside tabs */
.tabbed-block pre {
  margin-top: 0;
}

/* Make sure code highlighting works inside tabs */
.tabbed-block .highlight {
  margin: 0;
}



/* ============================================
   TABBED CONTENT - FORCE VISIBILITY
   ============================================ */

/* Force container visible */
.tabbed-set {
  display: block !important;
  visibility: visible !important;
  margin: 1.5rem 0 !important;
}

/* Force labels visible */
.tabbed-labels {
  display: flex !important;
  visibility: visible !important;
  gap: 0.25rem;
  border-bottom: 2px solid var(--emd-border);
  margin-bottom: 1rem;
}

.tabbed-labels > label {
  display: block !important;
  visibility: visible !important;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--emd-text-secondary);
  transition: all 0.2s ease;
  user-select: none;
  background: transparent;
}

.tabbed-labels > label:hover {
  color: var(--emd-text);
  background: var(--emd-bg-secondary);
}

/* Active tab styling - enhanced by JavaScript */
.tabbed-labels > label[data-active="true"] {
  color: var(--emd-primary) !important;
  border-bottom-color: var(--emd-primary) !important;
}

/* Force content container visible */
.tabbed-content {
  display: block !important;
  visibility: visible !important;
  padding: 0;
}

/* Blocks controlled by JavaScript - just set base styles */
.tabbed-block {
  background: transparent;
  padding: 0;
  margin: 0;
}

/* Animation for visible blocks */
.tabbed-block[data-active="true"] {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Code blocks inside tabs */
.tabbed-block pre {
  margin-top: 0;
}

.tabbed-block .highlight {
  margin: 0;
}


/* ============================================
   NESTED SIDEBAR GROUPS
   ============================================ */

/* Nested groups within groups */
[data-slot="sidebar-group-content"] [data-slot="sidebar-group"] {
  margin-left: 0.5rem;
  padding-left: 0.5rem;
  border-left: 1px solid var(--emd-border-light);
}

/* Nested group labels should be smaller */
[data-slot="sidebar-group-content"] [data-slot="sidebar-group-label"] {
  font-size: 0.7rem !important;
  padding: 0.3rem 0.4rem !important;
}

/* Make nested items more compact */
[data-slot="sidebar-group-content"] [data-slot="sidebar-group-content"] a {
  font-size: 0.75rem !important;
  padding-left: 1rem !important;
}


/* ============================================
   NESTED NAVIGATION ITEMS (JS-generated)
   ============================================ */

/* Nested folder headers */
.nested-folder {
  position: relative;
}

.nested-folder::before {
  content: "";
  display: inline-block;
  margin-right: 0.4rem;
  font-size: 0.7rem;
  opacity: 0.6;
  transition: transform 0.2s ease;
}

.nested-folder.expanded::before {
  transform: rotate(90deg);
}

.nested-folder:hover {
  background: var(--emd-bg-secondary) !important;
  color: var(--emd-text) !important;
}

/* Nested items list */
.nested-items {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease-out, opacity 0.2s ease;
  opacity: 0;
}

.nested-items:not(.collapsed) {
  max-height: 500px !important;
  opacity: 1 !important;
}


/* ============================================
   FORCE ROOT MENU ITEMS VISIBLE
   ============================================ */

/* Force Home and Contributors links to always be visible */
[data-slot="sidebar-menu"] > [data-slot="sidebar-menu-item"] {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Ensure the links inside are visible */
[data-slot="sidebar-menu"] > [data-slot="sidebar-menu-item"] > a {
  display: flex !important;
  visibility: visible !important;
}


/* ============================================
   DOCS CONTENT AREA PADDING
   ============================================ */

[data-slot="docs"] {
  padding-bottom: 3em !important;
}

/* ============================================
   ROOT GROUP (Home, Contributors) - NO LABEL
   ============================================ */

/* The first sidebar-group has no label - it contains Home and Contributors */
/* Force it to always be visible and not collapsible */
[data-slot="sidebar-group"]:not(:has([data-slot="sidebar-group-label"])) {
  display: block !important;
}

[data-slot="sidebar-group"]:not(:has([data-slot="sidebar-group-label"])) [data-slot="sidebar-group-content"] {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  max-height: none !important;
}

[data-slot="sidebar-group"]:not(:has([data-slot="sidebar-group-label"])) [data-slot="sidebar-menu-item"] {
  display: block !important;
  visibility: visible !important;
}

/* ============================================
   FIGURE CONTROLS — save + font toggle
   ============================================ */

.fig-wrap {
  display: inline-block;
  position: relative;
  max-width: 100%;
  line-height: 0;
}

.fig-wrap img {
  display: block;
  max-width: 100%;
}

.fig-bar {
  position: absolute;
  bottom: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  align-items: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.fig-wrap:hover .fig-bar {
  opacity: 1;
}

.fig-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--emd-border, #e2e8f0);
  border-radius: 5px;
  cursor: pointer;
  color: var(--emd-text-secondary, #475569);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  backdrop-filter: blur(4px);
  line-height: 1;
}

.dark .fig-btn {
  background: rgba(15, 23, 42, 0.88);
  border-color: var(--emd-border, #334155);
  color: var(--emd-text-secondary, #cbd5e1);
}

.fig-btn:hover {
  background: white;
  border-color: var(--emd-primary, #2196f3);
  color: var(--emd-primary, #2196f3);
}

.dark .fig-btn:hover {
  background: var(--emd-bg-secondary, #1e293b);
}

.fig-btn svg {
  pointer-events: none;
  display: block;
}


/* ============================================================
   HOMEPAGE FEATURE CARDS
   Row of three image cards above "Recent updates include:" on
   docs/index.md.
   At rest: image, no shadow, no gradient overlay.
   On hover: a frosted-glass panel drops over the image and the
   title reads through it. Font matches the rest of the page.
   ============================================================ */
.emd-home-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.25rem 0 1.75rem;
}
@media (max-width: 720px) {
  .emd-home-cards { grid-template-columns: 1fr; }
}

/* The card. 16:10 window so cards of mixed source ratios (source
   PNGs vary 1.37–1.79) still align. No box-shadow, no border
   accent — a plain rounded frame. */
.emd-home-card {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 8px;
  background: var(--md-default-fg-color--lightest, #e2e8f0);
  text-decoration: none !important;
  isolation: isolate;         /* keeps backdrop-filter scoped */
}
.emd-home-card:focus-visible {
  outline: 2px solid var(--md-primary-fg-color, #2196f3);
  outline-offset: 3px;
}

/* Image fills the card, untouched at rest. */
.emd-home-card-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  z-index: 0;
}

/* Title. Hidden at rest — the image speaks first. On hover it
   fades in, reading through the frosted panel below. Font
   matches the rest of the site (Noto Sans, per custom.css). */
.emd-home-card-title {
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  text-align: center;
  padding: 0 1rem;
  color: var(--md-default-fg-color, #1e293b);
  font-family: "Noto Sans", var(--font-sans), ui-sans-serif, system-ui, sans-serif;
  font-weight: 400;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  letter-spacing: 0;
  line-height: 1.25;
  opacity: 0;
  transition: opacity .25s ease;
}

/* Frosted glass panel: a pseudo-element rather than a scrim
   gradient. Uses backdrop-filter, which blurs whatever image
   sits behind it. Covers the entire card on hover so the
   whole image goes soft, and the title reads through it. */
.emd-home-card::after {
  content: "";
  position: absolute;
  inset: 0;                        /* full card */
  z-index: 1;
  background: rgba(255, 255, 255, .28);
  backdrop-filter: blur(2px) saturate(1.05);
  -webkit-backdrop-filter: blur(2px) saturate(1.05);
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}

.emd-home-card:hover::after,
.emd-home-card:focus-visible::after {
  opacity: 1;
}
.emd-home-card:hover .emd-home-card-title,
.emd-home-card:focus-visible .emd-home-card-title {
  opacity: 1;
}

/* Dark-mode tint: the frosted panel needs a darker base to
   sit over dark screenshot backgrounds, and the title flips
   to a light foreground. */
[data-md-color-scheme="slate"] .emd-home-card::after,
.dark .emd-home-card::after {
  background: rgba(20, 24, 32, .38);
}
[data-md-color-scheme="slate"] .emd-home-card-title,
.dark .emd-home-card-title {
  color: #f0f2f4;
}

/* Progressive enhancement: browsers without backdrop-filter
   (older Firefox, some embedded webviews) get a plain frosted
   translucent panel instead of a truly blurred one. Still
   readable, just less flashy. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .emd-home-card::after { background: rgba(255, 255, 255, .78); }
  [data-md-color-scheme="slate"] .emd-home-card::after,
  .dark .emd-home-card::after { background: rgba(20, 24, 32, .78); }
}

@media (prefers-reduced-motion: reduce) {
  .emd-home-card::after,
  .emd-home-card-title { transition: none; }
}
