/* ==========================================================================
   MIPP documentation stylesheet (overrides of Material for MkDocs)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens and palettes
   -------------------------------------------------------------------------- */

:root {
  --mipp-font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mipp-font-mono: "JetBrains Mono", "Fira Code", SFMono-Regular, Consolas, monospace;

  /* Brand Accents */
  --mipp-cyan: #0ea5e9;
  --mipp-cyan-glow: rgba(14, 165, 233, 0.25);
  --mipp-indigo: #6366f1;
  --mipp-emerald: #10b981;
  --mipp-emerald-glow: rgba(16, 185, 129, 0.2);
  --mipp-amber: #f59e0b;
  --mipp-slate-badge: #64748b;

  --mipp-radius-sm: 6px;
  --mipp-radius-md: 10px;
  --mipp-radius-lg: 16px;
  --mipp-transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);

  /* Implementation levels (L0 to L3, N/A): shared by the docs and the API Explorer */
  --mipp-lvl-0: #10b981;
  --mipp-lvl-0-bg: rgba(16, 185, 129, 0.12);
  --mipp-lvl-0-border: rgba(16, 185, 129, 0.3);
  --mipp-lvl-1: #3b82f6;
  --mipp-lvl-1-bg: rgba(59, 130, 246, 0.12);
  --mipp-lvl-1-border: rgba(59, 130, 246, 0.3);
  --mipp-lvl-2: #f59e0b;
  --mipp-lvl-2-bg: rgba(245, 158, 11, 0.12);
  --mipp-lvl-2-border: rgba(245, 158, 11, 0.3);
  --mipp-lvl-3: #6b7280;
  --mipp-lvl-3-bg: rgba(107, 114, 128, 0.12);
  --mipp-lvl-3-border: rgba(107, 114, 128, 0.3);
  --mipp-lvl-na: #94a3b8;
  --mipp-lvl-na-bg: rgba(148, 163, 184, 0.1);
  --mipp-lvl-na-border: rgba(148, 163, 184, 0.2);
}

/* Dark scheme (slate) */
[data-md-color-scheme="slate"] {
  --md-default-bg-color: #0b0f19;
  --md-default-bg-color--light: #111827;
  --md-default-bg-color--lighter: #1e293b;
  --md-default-bg-color--lightest: #334155;

  --md-default-fg-color: #f1f5f9;
  --md-default-fg-color--light: #cbd5e1;
  --md-default-fg-color--lighter: #94a3b8;
  --md-default-fg-color--lightest: #64748b;

  --md-primary-fg-color: #0ea5e9;
  --md-primary-fg-color--light: #38bdf8;
  --md-primary-fg-color--dark: #0284c7;
  --md-accent-fg-color: #38bdf8;
  --md-typeset-a-color: #38bdf8;

  --md-code-bg-color: #080c14;
  --md-code-fg-color: #e2e8f0;
  --md-code-hl-comment-color: #6ee7b7;

  --mipp-glass-bg: rgba(11, 15, 25, 0.85);
  --mipp-card-bg: rgba(17, 24, 39, 0.7);
  --mipp-card-border: rgba(255, 255, 255, 0.08);
  --mipp-card-hover-border: rgba(56, 189, 248, 0.4);

  --mipp-lvl-0: #34d399;
  --mipp-lvl-0-bg: rgba(52, 211, 153, 0.15);
  --mipp-lvl-0-border: rgba(52, 211, 153, 0.35);
  --mipp-lvl-1: #60a5fa;
  --mipp-lvl-1-bg: rgba(96, 165, 250, 0.15);
  --mipp-lvl-1-border: rgba(96, 165, 250, 0.35);
  --mipp-lvl-2: #fbbf24;
  --mipp-lvl-2-bg: rgba(251, 191, 36, 0.15);
  --mipp-lvl-2-border: rgba(251, 191, 36, 0.35);
  --mipp-lvl-3: #9ca3af;
  --mipp-lvl-3-bg: rgba(156, 163, 175, 0.15);
  --mipp-lvl-3-border: rgba(156, 163, 175, 0.3);
  --mipp-lvl-na: #64748b;
  --mipp-lvl-na-bg: rgba(100, 116, 139, 0.12);
  --mipp-lvl-na-border: rgba(100, 116, 139, 0.25);
}

/* Light scheme (default) */
[data-md-color-scheme="default"] {
  --md-default-bg-color: #f8fafc;
  --md-default-bg-color--light: #ffffff;
  --md-default-bg-color--lighter: #f1f5f9;

  --md-default-fg-color: #0f172a;
  --md-default-fg-color--light: #334155;
  --md-default-fg-color--lighter: #64748b;
  --md-default-fg-color--lightest: #94a3b8;

  --md-primary-fg-color: #ffffff;
  --md-primary-fg-color--light: #f8fafc;
  --md-primary-fg-color--dark: #e2e8f0;
  --md-accent-fg-color: #0284c7;
  --md-typeset-a-color: #0284c7;

  --md-code-bg-color: #ffffff;
  --md-code-fg-color: #0f172a;
  --md-code-hl-comment-color: #15803d;

  --mipp-glass-bg: rgba(255, 255, 255, 0.78);
  --mipp-card-bg: #ffffff;
  --mipp-card-border: #e2e8f0;
  --mipp-card-hover-border: rgba(14, 165, 233, 0.5);
}

/* --------------------------------------------------------------------------
   2. Typography and layout
   -------------------------------------------------------------------------- */

/* Wider grid (84rem) with side padding */
.md-grid {
  max-width: 84rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.md-header__inner {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* Full-width body for homepage and pages with hidden navigation */
.md-content:only-child,
.md-main__inner:not(:has(.md-sidebar--primary:not([hidden]))) .md-content {
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}

/* Same maximum width for all the content blocks (p, headings, pre, admonitions, tables)
   align to the exact same maximum content width so tables never stick out wider than text */
.md-content__inner {
  max-width: 100%;
}

.md-typeset {
  max-width: 100%;
  font-family: var(--mipp-font-sans);
  letter-spacing: -0.011em;
}

.md-typeset>* {
  box-sizing: border-box;
}

/* Previous / next links to another section, hidden by footer-nav.js: the
   display of Material would override the [hidden] attribute */
.md-footer__link[hidden],
.md-footer__inner[hidden] {
  display: none;
}

/* "Search in the API Explorer" link at the top of the search results
   (javascripts/search-explorer-link.js) */
.mipp-search-explorer-link {
  display: block;
  margin: 0.5rem 0.6rem;
  padding: 0.45rem 0.7rem;
  font-size: 0.66rem;
  font-weight: 500;
  color: var(--md-accent-fg-color);
  background-color: var(--md-accent-fg-color--transparent);
  border: 1px solid color-mix(in srgb, var(--md-accent-fg-color) 25%, transparent);
  border-radius: var(--mipp-radius-sm);
  transition: var(--mipp-transition);
}

.mipp-search-explorer-link:hover,
.mipp-search-explorer-link:focus {
  border-color: var(--md-accent-fg-color);
  background-color: color-mix(in srgb, var(--md-accent-fg-color) 16%, transparent);
}

/* "Mathematical semantics" box under the description of a Function Support
   page (generator/gen_mipp_docs.py), as in the API Explorer */
.md-typeset .mipp-math-semantics {
  margin: 0.9em 0;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--mipp-card-border);
  border-radius: var(--mipp-radius-sm);
  background-color: var(--mipp-card-bg);
  overflow-x: auto;
}

.md-typeset .mipp-math-semantics p {
  margin: 0;
}

/* "Open in the API Explorer" link under the description of a Function Support
   page (generator/gen_mipp_docs.py) */
.md-typeset .mipp-explorer-link {
  font-size: 0.8rem;
  font-weight: 500;
}

.md-typeset .mipp-explorer-link abbr {
  border-bottom: none;
}

/* Glossary abbreviations (docs/includes/abbreviations.md, appended to every
   page): dotted underline in running text only. In headings, tables and
   tab labels, where the same terms come back on every line, the underline is
   noise; the tooltip (title) stays */
.md-typeset :is(h1, h2, h3, h4, h5, h6, th, td, .tabbed-labels) abbr {
  border-bottom: none;
  text-decoration: none;
}

.md-typeset p:not(.admonition-title),
.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4,
.md-typeset h5,
.md-typeset h6,
.md-typeset ul,
.md-typeset ol,
.md-typeset blockquote,
.md-typeset pre,
.md-typeset .highlight,
.md-typeset .highlighttable,
.md-content__inner>.highlight,
.md-content__inner>pre,
.md-typeset .admonition,
.md-typeset .tabbed-set,
.md-typeset__scrollwrap,
.md-typeset__table,
.md-typeset div.arithmatex {
  max-width: 100%;
  box-sizing: border-box;
}

/* Eliminate full-bleed negative margins on code blocks and formulas across all viewports */
.md-content__inner>.highlight,
.md-content__inner>pre,
.md-typeset .highlight,
.md-typeset pre,
.md-typeset .highlighttable,
.md-typeset div.arithmatex {
  margin-left: 0;
  margin-right: 0;
  width: 100%;
}

code,
kbd,
pre,
.md-typeset code {
  font-family: var(--mipp-font-mono);
  /* No ligatures: `!=`, `<=`, `==` must render as typed, not as ≠, ≤, ... */
  font-variant-ligatures: none;
  font-feature-settings: "calt" 0, "liga" 0;
}

/* Inline Code Styling */
.md-typeset :not(pre)>code {
  padding: 0.15em 0.42em;
  border-radius: var(--mipp-radius-sm);
  font-size: 0.84em;
  font-weight: 500;
  white-space: break-spaces;
}

[data-md-color-scheme="default"] .md-typeset :not(pre)>code {
  background-color: #ffffff;
  color: #0284c7;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

[data-md-color-scheme="slate"] .md-typeset :not(pre)>code {
  background-color: rgba(14, 165, 233, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.28);
}

.md-typeset h1,
.md-typeset h2,
.md-typeset h3 {
  letter-spacing: -0.025em;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   3. Header, tabs and search
   -------------------------------------------------------------------------- */

/* The glass is drawn by a pseudo-element: a blurred header would be the
   containing block of its fixed descendants (the full-screen search of mobile
   would shrink to the header) and would isolate their backdrop (the search
   popup could not blur the page) */
.md-header {
  background-color: transparent;
  border-bottom: 1px solid var(--mipp-card-border);
}

.md-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-color: var(--mipp-glass-bg);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  pointer-events: none;
}

.md-header__button.md-logo img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* Tabs bar: same translucent background as the header, thin divider */
.md-tabs {
  background-color: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-top: 1px solid var(--mipp-card-border);
  border-bottom: none !important; /* Material adds one with [data-md-color-primary=white] */
}

.md-tabs__link {
  font-weight: 500;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  transition: var(--mipp-transition);
}

/* Light Mode Header & Tabs Explicit High-Contrast Text */
[data-md-color-scheme="default"] .md-header {
  color: #0f172a;
}

[data-md-color-scheme="default"] .md-header__title,
[data-md-color-scheme="default"] .md-header__topic,
[data-md-color-scheme="default"] .md-header__button,
[data-md-color-scheme="default"] .md-header .md-icon,
[data-md-color-scheme="default"] .md-header [data-md-component="logo"]~* {
  color: #0f172a !important;
}

[data-md-color-scheme="default"] .md-source,
[data-md-color-scheme="default"] .md-source__repository,
[data-md-color-scheme="default"] .md-source__facts {
  color: #334155;
}

[data-md-color-scheme="default"] .md-tabs__link {
  color: #475569;
}

/* Hover only changes the color: a bolder weight is wider and would shift the
   following tabs */
[data-md-color-scheme="default"] .md-tabs__item--active .md-tabs__link,
[data-md-color-scheme="default"] .md-tabs__link:hover {
  color: #0284c7 !important;
}

[data-md-color-scheme="default"] .md-tabs__item--active .md-tabs__link {
  font-weight: 600;
}

/* Search bar (light) */
[data-md-color-scheme="default"] .md-search__form {
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  border-radius: var(--mipp-radius-sm);
  transition: var(--mipp-transition);
}

[data-md-color-scheme="default"] .md-search__form:hover,
[data-md-color-scheme="default"] .md-search__form:focus-within {
  background-color: #ffffff !important;
  border-color: #0ea5e9 !important;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15) !important;
}

[data-md-color-scheme="default"] .md-search__input {
  background-color: transparent;
  color: #0f172a;
  border: none;
}

[data-md-color-scheme="default"] .md-search__input::placeholder {
  color: #94a3b8;
}

[data-md-color-scheme="default"] .md-search__icon {
  color: #64748b;
}

/* Dark Mode Header & Tabs Contrast */
[data-md-color-scheme="slate"] .md-header__title,
[data-md-color-scheme="slate"] .md-header__button,
[data-md-color-scheme="slate"] .md-source,
[data-md-color-scheme="slate"] .md-source__repository,
[data-md-color-scheme="slate"] .md-source__facts {
  color: #f1f5f9;
}

[data-md-color-scheme="slate"] .md-tabs__link {
  color: #94a3b8;
}

[data-md-color-scheme="slate"] .md-tabs__item--active .md-tabs__link,
[data-md-color-scheme="slate"] .md-tabs__link:hover {
  color: #38bdf8 !important;
}

[data-md-color-scheme="slate"] .md-tabs__item--active .md-tabs__link {
  font-weight: 600;
}

/* Dark Mode Search Bar */
[data-md-color-scheme="slate"] .md-search__form {
  background-color: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--mipp-radius-sm);
  transition: var(--mipp-transition);
}

[data-md-color-scheme="slate"] .md-search__form:hover,
[data-md-color-scheme="slate"] .md-search__form:focus-within {
  background-color: rgba(255, 255, 255, 0.09) !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2) !important;
}

[data-md-color-scheme="slate"] .md-search__input {
  background-color: transparent;
  color: #f1f5f9;
  border: none;
}

[data-md-color-scheme="slate"] .md-search__input::placeholder {
  color: #94a3b8;
}

[data-md-color-scheme="slate"] .md-search__icon {
  color: #94a3b8;
}

/* Search results popup: a frosted glass card detached from the search bar,
   with light separators (Material draws them with --md-default-fg-color--lightest,
   which is a text color here and too strong for a line) */
[data-md-color-scheme="default"] {
  --mipp-search-glass: rgba(255, 255, 255, 0.9);
  --mipp-search-overlay: rgba(15, 23, 42, 0.18);
  --mipp-search-border: rgba(15, 23, 42, 0.08);
  --mipp-search-sep: rgba(15, 23, 42, 0.06);
  --mipp-search-hover: rgba(14, 165, 233, 0.06);
  --mipp-search-shadow: 0 24px 48px -16px rgba(15, 23, 42, 0.22), 0 4px 12px -4px rgba(15, 23, 42, 0.08);
}

[data-md-color-scheme="slate"] {
  --mipp-search-glass: rgba(17, 24, 39, 0.68);
  --mipp-search-overlay: rgba(0, 0, 0, 0.45);
  --mipp-search-border: rgba(148, 163, 184, 0.16);
  --mipp-search-sep: rgba(148, 163, 184, 0.1);
  --mipp-search-hover: rgba(56, 189, 248, 0.08);
  --mipp-search-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.6), 0 4px 12px -4px rgba(0, 0, 0, 0.4);
}

@media screen and (min-width: 60em) {
  /* Material squares the corners joining the bar and the popup: keep the bar
     rounded, the popup floats under it */
  [data-md-toggle="search"]:checked ~ .md-header .md-search__form {
    border-radius: var(--mipp-radius-sm);
  }

  [data-md-toggle="search"]:checked ~ .md-header .md-search__output {
    top: 2.25rem;
    overflow: hidden;
    border: 1px solid var(--mipp-search-border);
    border-radius: var(--mipp-radius-md);
    background-color: var(--mipp-search-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: var(--mipp-search-shadow);
  }

  .md-search__scrollwrap {
    background-color: transparent;
  }

  /* Lighter than the Material overlay (54 % black): the glass would turn grey */
  [data-md-toggle="search"]:checked ~ .md-header .md-search__overlay {
    background-color: var(--mipp-search-overlay);
  }
}

.md-search-result__meta {
  background-color: transparent;
  color: var(--md-default-fg-color--lighter);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--mipp-search-sep);
}

.md-search-result__item {
  box-shadow: 0 -1px var(--mipp-search-sep);
}

.md-search-result__item:first-child {
  box-shadow: none;
}

.md-search-result__link:focus,
.md-search-result__link:hover,
.md-search-result__more > summary:focus > div,
.md-search-result__more > summary:hover > div {
  background-color: var(--mipp-search-hover);
}

.md-search-result__icon {
  color: var(--md-default-fg-color--lighter);
}

/* Result titles keep the Material size (the mobile headings of the pages are
   enlarged with !important) */
.md-search-result .md-typeset h1 {
  margin: 0.55rem 0 !important;
  font-size: 0.8rem !important;
  font-weight: 400;
  line-height: 1.4 !important;
}

/* --------------------------------------------------------------------------
   4. Implementation level badges (L0 to L3)
   -------------------------------------------------------------------------- */

/* Generic badge container (Pill shape identical to Explorer) */
.mipp-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.14rem 0.52rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  font-family: var(--md-code-font, monospace);
  vertical-align: middle;
  border: 1px solid transparent;
  white-space: nowrap;
}

/* Native Hardware */
.lvl-0 {
  background: var(--mipp-lvl-0-bg);
  color: var(--mipp-lvl-0);
  border: 1px solid var(--mipp-lvl-0-border);
}

/* Dedicated Emulation */
.lvl-1 {
  background: var(--mipp-lvl-1-bg);
  color: var(--mipp-lvl-1);
  border: 1px solid var(--mipp-lvl-1-border);
}

/* Generic Emulation */
.lvl-2 {
  background: var(--mipp-lvl-2-bg);
  color: var(--mipp-lvl-2);
  border: 1px solid var(--mipp-lvl-2-border);
}

/* Scalar Fallback */
.lvl-3 {
  background: var(--mipp-lvl-3-bg);
  color: var(--mipp-lvl-3);
  border: 1px solid var(--mipp-lvl-3-border);
}

/* not applicable */
.lvl-na {
  background: var(--mipp-lvl-na-bg);
  color: var(--mipp-lvl-na);
  border: 1px solid var(--mipp-lvl-na-border);
}

/* Level badges in running text, headings, legends and text tables (outside
   the API Explorer and the cells of the generated support matrices, which use
   .mipp-badge): sized relative to the surrounding text and kept on the
   baseline, so they read as a discreet inline tag */
.md-typeset .mipp-isa-badge:not(#mipp-explorer-app *),
.md-typeset .mipp-badge:not(td *) {
  display: inline-block;
  min-width: 0;
  height: auto;
  padding: 0 0.4em;
  font-size: 0.78em;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0;
  vertical-align: 0.08em;
  border-radius: 9999px;
}

/* --------------------------------------------------------------------------
   5. Code blocks and content tabs
   -------------------------------------------------------------------------- */

.md-typeset pre {
  margin: 1rem 0;
  max-width: 100%;
  width: 100%;
}

.md-typeset pre>code,
.md-content__inner>.highlight>pre>code,
.md-content__inner>pre>code {
  border-radius: var(--mipp-radius-md);
  border: 1px solid var(--mipp-card-border);
  border-left-width: 1px;
  border-right-width: 1px;
  font-size: 0.72rem;
  line-height: 1.45;
  padding: 0.65rem 0.85rem;
  box-sizing: border-box;
  max-width: 100%;
  width: 100%;
  overflow-x: auto;
  display: block !important;
}

[data-md-color-scheme="default"] .md-typeset pre>code,
[data-md-color-scheme="default"] .md-content__inner>.highlight>pre>code {
  background-color: var(--md-code-bg-color);
  color: var(--md-code-fg-color);
  border-color: #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* The containers stay transparent: only the rounded pre>code has a background,
   so that it does not overflow its rounded corners */
[data-md-color-scheme="default"] .highlight,
[data-md-color-scheme="default"] .highlight>pre {
  background-color: transparent;
}

/* Inside a tab, the white code is flush with the white tab content: a thin
   line separates it from the text written just before or after it */
[data-md-color-scheme="default"] .md-typeset .tabbed-block>:is(p, ul, ol, .admonition, details)+.highlight {
  border-top: 1px solid var(--mipp-card-border) !important;
}

[data-md-color-scheme="default"] .md-typeset .tabbed-block>.highlight:has(+ :is(p, ul, ol, .admonition, details)) {
  border-bottom: 1px solid var(--mipp-card-border) !important;
}

[data-md-color-scheme="slate"] .md-typeset pre>code,
[data-md-color-scheme="slate"] .md-content__inner>.highlight>pre>code {
  background-color: #080c14;
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

/* Distinct, high-legibility Code Comments in Light and Dark Modes */
.highlight .c,
.highlight .c1,
.highlight .ch,
.highlight .cm,
.highlight .cs,
.highlight .sd,
.md-typeset code .c,
.md-typeset code .c1,
.md-typeset code .ch,
.md-typeset code .cm,
.md-typeset code .cs,
.md-typeset code .sd {
  color: var(--md-code-hl-comment-color);
  font-style: italic;
}

/* --------------------------------------------------------------------------
   Collapsible Table of Contents (TOC)
   -------------------------------------------------------------------------- */

/* Hide TOC when toggled by user */
body[data-toc-hidden="true"] .md-sidebar--secondary {
  display: none !important;
}

body[data-toc-hidden="true"] .md-content {
  margin-right: 0 !important;
}

/* TOC Collapse Button in Sidebar Header */
.md-sidebar--secondary .md-nav__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mipp-toc-collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--mipp-radius-sm);
  border: 1px solid var(--mipp-card-border);
  background: transparent;
  color: var(--md-default-fg-color--lighter);
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  transition: var(--mipp-transition);
}

.mipp-toc-collapse-btn:hover {
  background: rgba(14, 165, 233, 0.12);
  color: var(--mipp-cyan);
  border-color: var(--mipp-cyan);
}

/* Room between the sticky header and the element of an anchor (:target).
   Material scrolls it 6rem under the top of the window (3.6rem below
   76.25em), about the height of its header: our header (title bar + tabs)
   is taller, the heading ended just under it. The measured height
   (--mipp-md-header-height, header-height.js) plus a gap instead; the second
   selector beats the one of Material with the lifted tabs. */
.md-typeset :target,
.md-header--lifted ~ .md-container .md-typeset :target {
  --md-scroll-margin: calc(var(--mipp-md-header-height, 4.8rem) + 1rem);
}

/* Floating Restore Button when TOC is hidden */
.mipp-toc-restore-btn {
  position: fixed;
  top: calc(var(--mipp-md-header-height, 4.8rem) + 0.6rem);
  right: 1.5rem;
  z-index: 25;
  display: none;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--mipp-font-mono);
  background: var(--mipp-card-bg);
  color: var(--md-default-fg-color--light);
  border: 1px solid var(--mipp-card-border);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: var(--mipp-transition);
}

.mipp-toc-restore-btn:hover {
  border-color: var(--mipp-cyan);
  color: var(--mipp-cyan);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--mipp-cyan-glow);
}

/* Never show floating TOC restore button on homepage */
body:has(.mipp-hero) .mipp-toc-restore-btn,
body:has(.mipp-hero) #mipp-toc-restore-btn {
  display: none !important;
}

/* Below 60em Material moves the TOC into the navigation drawer: there is no
   sidebar to restore (the button is shown by an inline style, hence !important) */
@media screen and (max-width: 59.984375em) {
  #mipp-toc-restore-btn {
    display: none !important;
  }
}

/* Tabbed sets (Segmented Control style) */
.md-typeset .tabbed-set {
  border-radius: var(--mipp-radius-md);
  border: 1px solid var(--mipp-card-border);
  overflow: hidden;
  background: var(--mipp-card-bg);
}

.md-typeset .tabbed-set>input:checked+label {
  color: var(--md-accent-fg-color) !important;
  font-weight: 600;
  border-bottom: 2px solid var(--md-accent-fg-color) !important;
  background: rgba(14, 165, 233, 0.08);
}

/* Remove nested margins and corner artifacts inside tabs to keep smooth outer rounded corners */
.md-typeset .tabbed-block>.highlight,
.md-typeset .tabbed-block pre,
.md-typeset .tabbed-block pre>code {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none;
  margin: 0;
}

/* Text, lists and admonitions inside a tab: inner margin aligned on the text of
   the code blocks (1em), which stay flush with the tab edges */
.md-typeset .tabbed-block>p:not(:has(>.md-typeset__scrollwrap)),
.md-typeset .tabbed-block>.admonition,
.md-typeset .tabbed-block>details {
  margin-left: 1em;
  margin-right: 1em;
}

.md-typeset .tabbed-block>ul,
.md-typeset .tabbed-block>ol {
  margin-left: 1.625em;
  margin-right: 1em;
}

.md-typeset .tabbed-block>:is(p:not(:has(>.md-typeset__scrollwrap)), ul, ol, .admonition, details):first-child {
  margin-top: 1em;
}

.md-typeset .tabbed-block>:is(p:not(:has(>.md-typeset__scrollwrap)), ul, ol, .admonition, details):last-child {
  margin-bottom: 1em;
}

/* Edge-to-Edge / Flush Tables inside Tabbed Sets (removes double borders & inner margins) */
.md-typeset .tabbed-block>.md-typeset__scrollwrap,
.md-typeset .tabbed-block>p>.md-typeset__scrollwrap,
.md-typeset .tabbed-block>.md-typeset__table {
  margin: 0 !important;
}

.md-typeset .tabbed-block .md-typeset__table {
  border: none;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  background: transparent;
}

.md-typeset .tabbed-block table:not([class]) {
  margin: 0;
  border: none;
}

.md-typeset .tabbed-block table:not([class]) th {
  border-top: none;
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
}

.md-typeset .tabbed-block table:not([class]) tr:last-child td {
  border-bottom: none;
}

/* Inline code in tab labels (e.g. "Zero-Masked (Z)"): plain letter, no chip */
.md-typeset .tabbed-labels>label code {
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  color: inherit;
  font-size: 0.92em;
}

/* Nested tabbed set (e.g. mask variants in a datatype tab): a light segmented
   control instead of a second row of underlined tabs */
.md-typeset .tabbed-block>.tabbed-set {
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.md-typeset .tabbed-block>.tabbed-set>.tabbed-labels {
  gap: 0.25rem;
  padding: 0.4rem 0.75rem !important;
  box-shadow: none;
  border-bottom: 1px solid var(--mipp-card-border);
  font-size: 0.62rem;
}

/* No sliding underline of Material: the active pill is enough */
.md-typeset .tabbed-block>.tabbed-set>.tabbed-labels::before {
  display: none;
}

.md-typeset .tabbed-block>.tabbed-set>.tabbed-labels>label {
  padding: 0;
  border: 1px solid transparent !important;
  border-radius: 999px;
  font-weight: 500;
  color: var(--md-default-fg-color--light);
}

.md-typeset .tabbed-block>.tabbed-set>.tabbed-labels>label:hover {
  color: var(--md-accent-fg-color);
}

/* Material moves the label padding to its anchor */
.md-typeset .tabbed-block>.tabbed-set>.tabbed-labels>label>a {
  padding: 0.2rem 0.65rem;
}

/* Active pill (Material links input n to label n; up to 10 nested tabs) */
.md-typeset .tabbed-block>.tabbed-set>input:nth-child(1):checked~.tabbed-labels>:nth-child(1),
.md-typeset .tabbed-block>.tabbed-set>input:nth-child(2):checked~.tabbed-labels>:nth-child(2),
.md-typeset .tabbed-block>.tabbed-set>input:nth-child(3):checked~.tabbed-labels>:nth-child(3),
.md-typeset .tabbed-block>.tabbed-set>input:nth-child(4):checked~.tabbed-labels>:nth-child(4),
.md-typeset .tabbed-block>.tabbed-set>input:nth-child(5):checked~.tabbed-labels>:nth-child(5),
.md-typeset .tabbed-block>.tabbed-set>input:nth-child(6):checked~.tabbed-labels>:nth-child(6),
.md-typeset .tabbed-block>.tabbed-set>input:nth-child(7):checked~.tabbed-labels>:nth-child(7),
.md-typeset .tabbed-block>.tabbed-set>input:nth-child(8):checked~.tabbed-labels>:nth-child(8),
.md-typeset .tabbed-block>.tabbed-set>input:nth-child(9):checked~.tabbed-labels>:nth-child(9),
.md-typeset .tabbed-block>.tabbed-set>input:nth-child(10):checked~.tabbed-labels>:nth-child(10) {
  border-color: rgba(14, 165, 233, 0.35) !important;
  background: rgba(14, 165, 233, 0.1);
  color: var(--md-accent-fg-color);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   6. Admonitions and tables
   -------------------------------------------------------------------------- */

.md-typeset .admonition,
.md-typeset details {
  border-radius: var(--mipp-radius-md);
  border-left-width: 4px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  border-top: 1px solid var(--mipp-card-border);
  border-right: 1px solid var(--mipp-card-border);
  border-bottom: 1px solid var(--mipp-card-border);
}

/* Admonition title: full-width color strip with rounded top corners */
.md-typeset .admonition-title,
.md-typeset summary {
  max-width: none;
  width: calc(100% + 1.2rem);
  margin: 0 -0.6rem 0.6rem -0.6rem !important;
  border-top-left-radius: inherit !important;
  border-top-right-radius: inherit !important;
}

/* Table wrapper: eliminate negative margins so tables align perfectly with paragraphs */
.md-typeset__scrollwrap {
  margin: 1.2rem 0 !important;
  max-width: 100%;
  width: 100%;
}

/* Table container: full width, horizontal scrolling */
.md-typeset__table {
  padding: 0;
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-radius: var(--mipp-radius-md);
  border: 1px solid var(--mipp-card-border);
  margin: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  background-color: var(--mipp-card-bg);
  box-sizing: border-box;
}

/* Compact, dense and readable table cells */
.md-typeset table:not([class]) {
  border-collapse: collapse;
  width: 100%;
  min-width: 100%;
  display: table;
  font-size: 0.76rem;
  line-height: 1.35;
  margin: 0;
  border: none;
  background: transparent;
}

.md-typeset table:not([class]) thead,
.md-typeset table:not([class]) thead tr {
  background-color: rgba(14, 165, 233, 0.08);
}

.md-typeset table:not([class]) th {
  background-color: rgba(14, 165, 233, 0.08);
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  padding: 0.45rem 0.65rem;
  white-space: nowrap;
  border-bottom: 2px solid rgba(14, 165, 233, 0.3);
  color: var(--md-default-fg-color);
  text-align: left;
}

.md-typeset table:not([class]) th:first-child {
  border-top-left-radius: calc(var(--mipp-radius-md) - 1px);
}

.md-typeset table:not([class]) th:last-child {
  border-top-right-radius: calc(var(--mipp-radius-md) - 1px);
}

.md-typeset table:not([class]) td {
  padding: 0.35rem 0.55rem;
  font-size: 0.76rem;
  border-top: 1px solid var(--mipp-card-border);
  vertical-align: middle;
}

.md-typeset table:not([class]) td:first-child {
  font-weight: 600;
  white-space: nowrap;
}

/* A row label that lists identifiers (two code or more) wraps between them, at
   most 22rem wide: on one line, it would crush the other columns */
.md-typeset table:not([class]) td:first-child:has(code + code) {
  white-space: normal;
  max-width: min(40vw, 22rem);
}

/* An identifier of a cell is not cut in the middle (Material: break-word):
   the column grows to the longest one, or the table scrolls */
.md-typeset table:not([class]) td code {
  word-break: normal;
}

/* Compact shield badges inside tables */
.md-typeset table:not([class]) img {
  max-height: 18px;
  width: auto;
  vertical-align: middle;
  display: inline-block;
}

.md-typeset table:not([class]) tr:hover td {
  background-color: rgba(14, 165, 233, 0.05);
}

/* Sticky first column: a wide table scrolls horizontally inside its frame
   (phones, comparison and support matrices), the row labels stay visible.
   Opaque backgrounds, stacked like the frame (card over page background, plus
   the header tint), so that the scrolled cells do not show through */
.md-typeset table:not([class]) th:first-child,
.md-typeset table:not([class]) td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
}

.md-typeset table:not([class]) td:first-child {
  background:
    linear-gradient(var(--mipp-card-bg), var(--mipp-card-bg)),
    var(--md-default-bg-color);
}

/* No fade of the row tint (Material: 125 ms): the opaque background of the
   sticky first cell is a stack of gradients, which cannot be animated, so the
   first column would change before the others during the fade */
.md-typeset table:not([class]) tbody tr {
  transition: none;
}

/* Hovered row: the cell tint, over the row tint of Material (tbody tr:hover) */
.md-typeset table:not([class]) tr:hover td:first-child {
  background:
    linear-gradient(rgba(14, 165, 233, 0.05), rgba(14, 165, 233, 0.05)),
    linear-gradient(var(--md-typeset-table-color--light), var(--md-typeset-table-color--light)),
    linear-gradient(var(--mipp-card-bg), var(--mipp-card-bg)),
    var(--md-default-bg-color);
}

/* The header tint is set on thead, tr and th (three layers): same stack here */
.md-typeset table:not([class]) th:first-child {
  background:
    linear-gradient(rgba(14, 165, 233, 0.08), rgba(14, 165, 233, 0.08)),
    linear-gradient(rgba(14, 165, 233, 0.08), rgba(14, 165, 233, 0.08)),
    linear-gradient(rgba(14, 165, 233, 0.08), rgba(14, 165, 233, 0.08)),
    linear-gradient(var(--mipp-card-bg), var(--mipp-card-bg)),
    var(--md-default-bg-color);
}

/* Below the desktop layout, most wide tables scroll: show the column edge */
@media screen and (max-width: 76.1875em) {
  .md-typeset table:not([class]) th:first-child,
  .md-typeset table:not([class]) td:first-child {
    box-shadow: inset -1px 0 0 var(--mipp-card-border);
  }
}

/* Phones: a long row label (list of datatypes, code, sentence) would make the
   sticky column as wide as the frame and hide the scrolled columns under it.
   The label wraps instead, at most 40% of the screen; long identifiers break
   anywhere, so that they do not widen the column again */
@media screen and (max-width: 44.9375em) {
  .md-typeset table:not([class]) th:first-child,
  .md-typeset table:not([class]) td:first-child {
    white-space: normal;
    min-width: 6.5rem;
    max-width: 40vw;
  }

  .md-typeset table:not([class]) td:first-child code {
    overflow-wrap: anywhere;
  }
}

/* Level badges in the support matrices */
.md-typeset table td:has(.mipp-badge),
.md-typeset table td:has(.twemoji) {
  text-align: center;
  padding: 0.25rem 0.35rem;
}

.md-typeset table td .mipp-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 18px;
  padding: 0 5px;
  font-size: 0.64rem;
  font-weight: 600;
  line-height: 1;
  border-radius: 9999px;
  font-family: var(--md-code-font, monospace);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  vertical-align: middle;
}

.md-typeset table td .mipp-badge:hover {
  transform: scale(1.15);
}

.md-typeset table td>span:has(.twemoji) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  padding: 0 4px;
  border-radius: var(--mipp-radius-sm, 6px);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  vertical-align: middle;
}

.md-typeset table td>span:has(.twemoji):hover {
  transform: scale(1.18);
}

.md-typeset table td .twemoji {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.md-typeset table td .twemoji svg {
  width: 12px;
  height: 12px;
  display: block;
}

/* Comparison tables of "Why MIPPv2": neutral palette, a single accent for
   supported features and a light tint on the MIPPv2 column / row */
.mipp-compare {
  --mipp-compare-tint: rgba(14, 165, 233, 0.06);
  --mipp-compare-yes: #059669;
}

[data-md-color-scheme="slate"] .mipp-compare {
  --mipp-compare-tint: rgba(56, 189, 248, 0.08);
  --mipp-compare-yes: #34d399;
}

.md-typeset .mipp-compare table:not([class]) {
  font-size: 0.72rem;
}

/* Header row: blue background and bottom rule of the other tables */
.md-typeset .mipp-compare table:not([class]) th {
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0;
  padding: 0.6rem 0.6rem;
  vertical-align: bottom;
}

.md-typeset .mipp-compare table:not([class]) th a,
.md-typeset .mipp-compare table:not([class]) td:first-child a {
  color: var(--md-default-fg-color);
}

.md-typeset .mipp-compare table:not([class]) th a:hover,
.md-typeset .mipp-compare table:not([class]) td:first-child a:hover {
  color: var(--md-accent-fg-color);
}

.md-typeset .mipp-compare table:not([class]) td {
  padding: 0.45rem 0.6rem;
  font-size: 0.72rem;
  color: var(--md-default-fg-color);
}

.md-typeset .mipp-compare table:not([class]) td:first-child {
  font-weight: 500;
}

.md-typeset .mipp-compare table:not([class]) tr:hover td {
  background-color: transparent;
}

/* Highlighted MIPPv2 column (features, below the header row) and row
   (project status) */
.md-typeset .mipp-compare:not(.mipp-compare--status) table:not([class]) td:nth-child(2),
.md-typeset .mipp-compare--status table:not([class]) tbody tr:first-child td {
  background-color: var(--mipp-compare-tint);
}

/* Sticky first column (see the generic table rules): no hover tint, MIPPv2
   row tint kept, and a divider showing where the scrolled cells go under */
.md-typeset .mipp-compare table:not([class]) th:first-child,
.md-typeset .mipp-compare table:not([class]) td:first-child {
  box-shadow: inset -1px 0 0 var(--mipp-card-border);
}

.md-typeset .mipp-compare table:not([class]) tr:hover td:first-child {
  background:
    linear-gradient(var(--md-typeset-table-color--light), var(--md-typeset-table-color--light)),
    linear-gradient(var(--mipp-card-bg), var(--mipp-card-bg)),
    var(--md-default-bg-color);
}

.md-typeset .mipp-compare--status table:not([class]) tbody tr:first-child td:first-child {
  background:
    linear-gradient(var(--mipp-compare-tint), var(--mipp-compare-tint)),
    linear-gradient(var(--mipp-card-bg), var(--mipp-card-bg)),
    var(--md-default-bg-color);
}

/* Phones: wrap the row labels instead of a wide sticky column */
@media screen and (max-width: 44.9375em) {
  .md-typeset .mipp-compare table:not([class]) td:first-child {
    white-space: normal;
    min-width: 6.5rem;
    max-width: 8rem;
  }
}

/* Secondary detail under a value */
.md-typeset .mipp-compare small,
.md-typeset .mipp-compare th small {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.64rem;
  font-weight: 400;
  line-height: 1.3;
  color: var(--md-default-fg-color--light);
}

.md-typeset .mipp-compare small code {
  font-size: 0.95em;
  padding: 0 0.25em;
  color: inherit;
  white-space: nowrap;
}

/* Status markers */
.md-typeset .mipp-compare .y,
.md-typeset .mipp-compare .p,
.md-typeset .mipp-compare .n,
.md-typeset .mipp-compare-legend .y,
.md-typeset .mipp-compare-legend .p,
.md-typeset .mipp-compare-legend .n {
  font-weight: 600;
}

.md-typeset .mipp-compare .y,
.md-typeset .mipp-compare-legend .y {
  color: var(--mipp-compare-yes, #059669);
}

.md-typeset .mipp-compare .p,
.md-typeset .mipp-compare-legend .p {
  color: var(--md-default-fg-color--light);
}

.md-typeset .mipp-compare .n,
.md-typeset .mipp-compare .na,
.md-typeset .mipp-compare-legend .n {
  color: var(--md-default-fg-color--lighter);
}

.md-typeset .mipp-compare .na {
  font-size: 0.66rem;
}

.md-typeset .mipp-compare-legend {
  margin-top: -0.6rem;
  font-size: 0.66rem;
  color: var(--md-default-fg-color--light);
}

[data-md-color-scheme="slate"] .md-typeset .mipp-compare-legend .y {
  color: #34d399;
}

/* Value-only grey badges (live GitHub metrics) */
.md-typeset .mipp-compare table:not([class]) img {
  max-height: 18px;
  border-radius: 3px;
}

/* --------------------------------------------------------------------------
   7. Home page (hero, buttons, cards)
   -------------------------------------------------------------------------- */

.mipp-hero {
  padding: 2.5rem 0 2rem 0;
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
}

.mipp-hero-title {
  font-size: 3rem;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.035em;
  margin-bottom: 1rem !important;
}

/* Gradient on the text only: background-clip on the <h1> would also clip
   the box-shadow of the MIPPv2 badge to the heading box */
.mipp-hero-title-text {
  background: linear-gradient(135deg, #0284c7 0%, #6366f1 50%, #9333ea 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-md-color-scheme="slate"] .mipp-hero-title-text {
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* MIPPv2 badge next to the title */
.mipp-hero-title .mippv2,
.mippv2 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mipp-font-mono);
  font-size: 0.38em;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 0.24em 0.75em;
  margin-left: 0.5em;
  border-radius: 9999px;
  vertical-align: middle;
  line-height: 1.2;
  position: relative;
  transition: var(--mipp-transition);
  cursor: default;
}

/* Light scheme */
[data-md-color-scheme="default"] .mipp-hero-title .mippv2,
[data-md-color-scheme="default"] .mippv2 {
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
  border: 1px solid rgba(14, 165, 233, 0.9);
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Dark scheme */
[data-md-color-scheme="slate"] .mipp-hero-title .mippv2,
[data-md-color-scheme="slate"] .mippv2 {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.25) 0%, rgba(99, 102, 241, 0.35) 100%);
  color: #38bdf8;
  -webkit-text-fill-color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.75);
  box-shadow: 0 0 18px rgba(14, 165, 233, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.7);
}

.mippv2:hover {
  transform: translateY(-2px) scale(1.05);
}

.mipp-hero-subtitle {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--md-default-fg-color--light);
  margin-bottom: 2rem;
  max-width: 750px;
  margin-left: auto;
  margin-right: auto;
}

/* Call To Action Buttons (Fixed non-breaking layout across all browsers) */
.mipp-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: center;
  align-items: center;
  margin-bottom: 2.5rem;
}

.mipp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 1.3rem;
  border-radius: var(--mipp-radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
  transition: var(--mipp-transition);
}

.mipp-btn svg {
  flex-shrink: 0;
  width: 1.15em;
  height: 1.15em;
  vertical-align: middle;
}

.mipp-btn-primary {
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  color: #ffffff !important;
  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.35);
}

.mipp-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(14, 165, 233, 0.5);
  filter: brightness(1.1);
}

.mipp-btn-secondary {
  background: var(--mipp-card-bg);
  color: var(--md-default-fg-color) !important;
  border: 1px solid var(--mipp-card-border);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.mipp-btn-secondary:hover {
  transform: translateY(-2px);
  border-color: var(--mipp-card-hover-border);
  background: rgba(14, 165, 233, 0.08);
}

/* --------------------------------------------------------------------------
   Featured MIPP API Explorer Showcase Card (Homepage)
   -------------------------------------------------------------------------- */

/* Hardware Target Chips */
.mipp-chips-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 0rem;
}

.mipp-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-family: var(--mipp-font-mono);
  background: var(--mipp-card-bg);
  border: 1px solid var(--mipp-card-border);
  color: var(--md-default-fg-color--lighter);
  transition: var(--mipp-transition);
}

.mipp-chip:hover {
  border-color: var(--mipp-cyan);
  color: var(--mipp-cyan);
  transform: translateY(-1px);
}

/* 2x2 Feature Cards Grid (Homepage) */
.mipp-home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin: 2.5rem 0;
}

.mipp-home-card {
  padding: 1.4rem;
  border-radius: var(--mipp-radius-md);
  background: var(--mipp-card-bg);
  border: 1px solid var(--mipp-card-border);
  transition: var(--mipp-transition);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.mipp-home-card:hover {
  transform: translateY(-2px);
  border-color: var(--mipp-card-hover-border);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

.mipp-home-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.mipp-home-card-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.22);
  color: var(--mipp-cyan);
  font-size: 1.15rem;
  line-height: 1;
}

.mipp-home-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 !important;
  color: var(--md-default-fg-color);
  line-height: 1.3;
}

.mipp-home-card-desc {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--md-default-fg-color--lighter);
  margin: 0;
}

[data-md-color-scheme="slate"] .mipp-home-card:hover {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.35);
}

/* Dark mode image adjustments (selective invert only for explicitly tagged elements) */
/* Remove top GitHub button from navigation drawer / sidebar */
.md-nav__source,
.md-sidebar .md-source {
  display: none;
}

/* --------------------------------------------------------------------------
   7.1 Desktop Sidebar Stabilization & Scrollbar Fix (min-width: 76.25em)
   -------------------------------------------------------------------------- */

@media screen and (min-width: 76.25em) {

  /* Ensure the main container fills at least the available viewport height,
     preventing sticky sidebar collapse and keeping footer at bottom on short pages */
  .md-main__inner {
    margin-top: 0;
    min-height: calc(100vh - var(--mipp-md-header-height, 4.8rem));
  }

  /* Fixed/sticky sidebar bounded cleanly between tabs header and footer.
     --mipp-md-header-height is the measured header height (header-height.js):
     a fixed value lets the sidebar slide under the header when scrolling */
  /* The sidebar is as tall as its menu, at most the viewport height under the
     header: a short menu is then never pushed under the header by the footer
     at the bottom of the page, a long one scrolls inside the sidebar */
  .md-sidebar {
    position: sticky;
    top: var(--mipp-md-header-height, 4.8rem) !important;
    flex-direction: column;
    height: auto;
    max-height: calc(100vh - var(--mipp-md-header-height, 4.8rem));
    padding: 0;
    overflow: hidden;
  }

  /* Flex only on visible sidebars: Material hides them with the [hidden]
     attribute (front matter "hide: navigation / toc"), whose display: none
     comes from the user-agent style sheet and would be overridden */
  .md-sidebar:not([hidden]) {
    display: flex;
  }

  /* Scroll container with independent scrollbar ("ascenseur"), shrunk to
     the sidebar max height, preventing scroll chaining */
  .md-sidebar__scrollwrap {
    flex: 0 1 auto;
    min-height: 0;
    height: auto !important;
    max-height: 100%;
    padding: 1.2rem 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
  }

  /* Enhanced, visible scrollbar on desktop sidebar */
  .md-sidebar__scrollwrap::-webkit-scrollbar {
    width: 5px;
  }

  .md-sidebar__scrollwrap::-webkit-scrollbar-track {
    background: transparent;
  }

  .md-sidebar__scrollwrap::-webkit-scrollbar-thumb {
    background-color: var(--md-default-fg-color--lighter);
    border-radius: 4px;
  }

  .md-sidebar__scrollwrap::-webkit-scrollbar-thumb:hover {
    background-color: var(--mipp-cyan);
  }

  /* Preserve main content top spacing when md-main__inner margin-top is 0 */
  .md-content__inner {
    padding-top: 1.5rem;
  }

  /* Keep footer layered cleanly below main content */
  .md-footer {
    position: relative;
    z-index: 2;
  }
}

/* Between the phones and the full header (60em to 76.25em, no tabs): the same top spacing as above
   76.25em. Material's margin of 1.5rem stayed there, added to the one of the API Explorer. */
@media screen and (min-width: 60em) and (max-width: 76.1875em) {
  .md-main__inner {
    margin-top: 0;
  }

  .md-content__inner {
    padding-top: 1.5rem;
  }
}

/* --------------------------------------------------------------------------
   8. Navigation drawer (< 1220px)
   -------------------------------------------------------------------------- */

@media screen and (max-width: 76.1875em) {

  /* Strictly hide TOC toggle links inside drawer to prevent duplicate entries */
  .md-nav--primary .md-nav__link[for="__toc"],
  .md-nav--primary [for="__toc"] {
    display: none;
  }

  /* Same background for the drawer and its submenus */
  .md-nav--primary,
  .md-nav--primary .md-nav {
    background-color: var(--md-default-bg-color);
  }

  [data-md-color-scheme="slate"] .md-nav--primary,
  [data-md-color-scheme="slate"] .md-nav--primary .md-nav {
    background-color: #0b0f19;
  }

  [data-md-color-scheme="default"] .md-nav--primary,
  [data-md-color-scheme="default"] .md-nav--primary .md-nav {
    background-color: #f8fafc;
  }

  /* Drawer headers (root and submenus) */
  .md-nav--primary .md-nav__title {
    height: auto;
    padding: 1rem 1rem;
    line-height: 1.4;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    border-bottom: 1px solid var(--mipp-card-border);
    display: flex !important;
    align-items: center;
    gap: 0.75rem;
    white-space: normal;
  }

  [data-md-color-scheme="default"] .md-nav--primary .md-nav__title,
  [data-md-color-scheme="default"] .md-nav--primary .md-nav__title[for="__drawer"] {
    background: #ffffff;
    color: #0f172a;
    border-bottom: 1px solid #e2e8f0;
  }

  [data-md-color-scheme="slate"] .md-nav--primary .md-nav__title,
  [data-md-color-scheme="slate"] .md-nav--primary .md-nav__title[for="__drawer"] {
    background: #0f172a;
    color: #f8fafc;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  /* Logo container in mobile drawer header */
  .md-nav--primary .md-nav__title .md-logo {
    position: static;
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .md-nav--primary .md-nav__title .md-logo img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  }

  /* Submenu Back button arrow */
  .md-nav--primary .md-nav__title .md-nav__icon {
    position: static;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 6px;
    background: rgba(14, 165, 233, 0.1);
    color: var(--md-accent-fg-color);
    transition: var(--mipp-transition);
  }

  .md-nav--primary .md-nav__title .md-nav__icon:hover {
    background: rgba(14, 165, 233, 0.22) !important;
    transform: translateX(-2px);
  }

  /* Floating Pills: eliminate harsh horizontal lines */
  .md-nav--primary .md-nav__item {
    border-top: none;
    margin: 0.15rem 0;
  }

  .md-nav--primary .md-nav__title~.md-nav__list {
    box-shadow: none;
    padding: 0.5rem 0.65rem;
  }

  .md-nav--primary .md-nav__link:not([for="__toc"]) {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.85rem !important;
    border-radius: var(--mipp-radius-sm, 7px);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--md-default-fg-color);
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    margin-top: 0;
  }

  /* Hover state on items */
  .md-nav--primary .md-nav__link:not([for="__toc"]):hover {
    background-color: rgba(14, 165, 233, 0.08) !important;
    color: var(--md-accent-fg-color) !important;
    transform: translateX(3px);
  }

  [data-md-color-scheme="slate"] .md-nav--primary .md-nav__link:not([for="__toc"]):hover {
    background-color: rgba(56, 189, 248, 0.12) !important;
    color: #38bdf8 !important;
  }

  /* Active Page Pill with Soft Glow and Left Accent Marker */
  .md-nav--primary .md-nav__item--active>.md-nav__link:not([for="__toc"]),
  .md-nav--primary .md-nav__link--active:not([for="__toc"]) {
    font-weight: 600 !important;
    padding-left: 1.15rem !important;
  }

  [data-md-color-scheme="default"] .md-nav--primary .md-nav__item--active>.md-nav__link:not([for="__toc"]),
  [data-md-color-scheme="default"] .md-nav--primary .md-nav__link--active:not([for="__toc"]) {
    background-color: rgba(14, 165, 233, 0.12);
    color: #0284c7 !important;
  }

  [data-md-color-scheme="slate"] .md-nav--primary .md-nav__item--active>.md-nav__link:not([for="__toc"]),
  [data-md-color-scheme="slate"] .md-nav--primary .md-nav__link--active:not([for="__toc"]) {
    background-color: rgba(56, 189, 248, 0.15);
    color: #38bdf8 !important;
    box-shadow: 0 0 16px rgba(14, 165, 233, 0.15);
  }

  /* Left glowing accent indicator */
  .md-nav--primary .md-nav__item--active>.md-nav__link:not([for="__toc"])::before,
  .md-nav--primary .md-nav__link--active:not([for="__toc"])::before {
    content: "";
    position: absolute;
    left: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3.5px;
    height: 16px;
    border-radius: 9999px;
    background: #0ea5e9;
    box-shadow: 0 0 8px #0ea5e9;
  }

  /* A section that has a page of its own: its row is a container (.md-nav__container) that holds
     the link to the page and the toggle of the submenu, and each of the three is a .md-nav__link.
     The container is the pill: the link and the toggle inside it are plain */
  .md-nav--primary .md-nav__container>.md-nav__link:not([for="__toc"]) {
    padding: 0 !important;
    border-radius: 0;
    box-shadow: none !important;
    transform: none !important;
    /* the colour and the weight of the row (active, hovered), without a transition of their own:
       they follow the one of the row */
    color: inherit;
    font-weight: inherit;
    transition: none;
  }

  /* ... on hover too: the row is highlighted as a whole (the selectors repeat the ones of the hover
     rules above, the dark one included, to take precedence over them) */
  .md-nav--primary .md-nav__container>.md-nav__link:not([for="__toc"]),
  .md-nav--primary .md-nav__container>.md-nav__link:not([for="__toc"]):hover,
  [data-md-color-scheme="slate"] .md-nav--primary .md-nav__container>.md-nav__link:not([for="__toc"]):hover {
    background: none !important;
  }

  .md-nav--primary .md-nav__container>.md-nav__link:not([for="__toc"])::before {
    content: none;
  }

  .md-nav--primary .md-nav__container>a.md-nav__link {
    flex: 1 1 auto;
    min-width: 0;
  }

  /* the toggle keeps a touch target of the height of the row (the margins cancel the padding) */
  .md-nav--primary .md-nav__container>label.md-nav__link:not([for="__toc"]) {
    flex: 0 0 auto;
    padding: 0.55rem 0.85rem 0.55rem 0.5rem !important;
    margin: -0.55rem -0.85rem -0.55rem 0;
  }

  /* Chevrons of the nested menu items */
  .md-nav--primary .md-nav__link .md-nav__icon {
    width: 1rem;
    height: 1rem;
    opacity: 0.55;
    transition: transform 0.2s ease, opacity 0.2s ease;
    margin: 0 !important;
  }

  .md-nav--primary .md-nav__link:hover .md-nav__icon {
    opacity: 1;
    transform: translateX(2px);
  }
}

/* --------------------------------------------------------------------------
   9. Small screens (< 960px and < 720px)
   -------------------------------------------------------------------------- */

@media screen and (max-width: 59.984375em) {

  /* 0. Prevent any horizontal page panning / viewport scrolling on mobile.
     clip, not hidden: hidden makes the body a scroll container, which never
     scrolls (the document does), and the sticky header then scrolled away.
     Except on the API Explorer: its header scrolls away, the room is left to
     the cards (relative, not static, keeps the stacking of the header) */
  body.mipp-has-explorer .md-header,
  body:has(#mipp-explorer-app) .md-header {
    position: relative;
  }

  html,
  body {
    overflow-x: clip;
    max-width: 100vw;
    width: 100%;
  }

  .md-container,
  .md-main,
  .md-content {
    overflow-x: hidden;
    max-width: 100%;
  }

  /* 1. Drastically reduce outer margins & paddings on mobile to maximize viewport width */
  .md-grid {
    padding-left: 0.4rem !important;
    padding-right: 0.4rem !important;
  }

  .md-header__inner {
    padding-top: 0.25rem !important;
    padding-bottom: 0.25rem !important;
    padding-left: 0.35rem !important;
    padding-right: 0.35rem !important;
  }

  .md-main__inner {
    margin-top: 0;
  }

  .md-content__inner {
    margin-left: 0.15rem;
    margin-right: 0.15rem;
    padding-top: 0.35rem;
  }

  .md-typeset {
    padding: 0 !important;
  }

  /* 2. Header Icons: drastically reduce padding and margin left/right */
  .md-header__button {
    margin: 0 !important;
    padding: 0.2rem 0.15rem;
  }

  .md-header__button.md-logo {
    padding: 0.12rem 0.15rem !important;
    margin-right: 0.15rem !important;
  }

  .md-header__button.md-logo img {
    width: 26px !important;
    height: 26px !important;
  }

  .md-header__title {
    margin-left: 0.2rem !important;
    font-size: 0.85rem;
    font-weight: 700;
  }

  .md-header__topic {
    font-size: 0.85rem;
  }

  .md-header .md-icon svg {
    width: 20px;
    height: 20px;
  }

  [data-md-color-scheme="default"] .md-search__inner {
    background-color: #ffffff;
  }

  /* 3. Slightly decrease typography on mobile */
  .md-typeset {
    font-size: 0.78rem;
    line-height: 1.55;
  }

  .md-typeset h1 {
    font-size: 1.35rem !important;
    line-height: 1.22 !important;
    margin-top: 0.5rem;
    margin-bottom: 0.55rem !important;
  }

  .md-typeset h2 {
    font-size: 1.15rem;
    line-height: 1.28;
    margin-top: 1.2rem;
    margin-bottom: 0.45rem;
  }

  .md-typeset h3 {
    font-size: 1.0rem !important;
    line-height: 1.32;
    margin-top: 0.9rem !important;
    margin-bottom: 0.35rem !important;
  }

  .md-typeset h4,
  .md-typeset h5,
  .md-typeset h6 {
    font-size: 0.88rem;
  }

  .md-typeset p {
    margin-bottom: 0.7rem !important;
  }

  /* 4. Code Blocks & Elements Width Alignment (Identical width to admonitions, tables, text) */
  .md-content__inner>.highlight,
  .md-content__inner>pre,
  .md-typeset .highlight,
  .md-typeset pre,
  .md-typeset .highlighttable {
    margin-left: 0;
    margin-right: 0;
    margin-top: 0.55rem;
    margin-bottom: 0.55rem !important;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }

  /* Restore left and right visible borders and rounded corners on mobile */
  .md-content__inner>.highlight>pre>code,
  .md-content__inner>pre>code,
  .md-typeset .highlight pre>code,
  .md-typeset pre>code {
    border: 1px solid var(--mipp-card-border);
    border-left-width: 1px;
    border-right-width: 1px;
    border-top-width: 1px;
    border-bottom-width: 1px;
    border-radius: var(--mipp-radius-sm) !important;
    font-size: 0.65rem;
    line-height: 1.38;
    padding: 0.45rem 0.55rem;
    box-sizing: border-box;
    max-width: 100%;
    width: 100%;
    overflow-x: auto;
    display: block;
  }

  [data-md-color-scheme="default"] .md-content__inner>.highlight>pre>code,
  [data-md-color-scheme="default"] .md-typeset pre>code {
    border-color: #e2e8f0;
    background-color: #ffffff;
  }

  [data-md-color-scheme="slate"] .md-content__inner>.highlight>pre>code,
  [data-md-color-scheme="slate"] .md-typeset pre>code {
    border-color: rgba(255, 255, 255, 0.08);
    background-color: #080c14;
  }

  /* Code block filename / title header on mobile */
  .md-typeset .highlight .filename,
  .md-content__inner>.highlight>.filename,
  .md-typeset .highlighttable th.filename span.filename {
    border-top-left-radius: var(--mipp-radius-sm) !important;
    border-top-right-radius: var(--mipp-radius-sm) !important;
    border: 1px solid var(--mipp-card-border) !important;
    border-bottom: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    font-size: 0.65rem !important;
    padding: 0.35rem 0.55rem !important;
    box-sizing: border-box !important;
  }

  .md-typeset .highlight .filename+pre>code,
  .md-content__inner>.highlight>.filename+pre>code {
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
  }

  /* Inside tabbed sets: remain flush with outer tab container without nested borders */
  .md-typeset .tabbed-block>.highlight,
  .md-typeset .tabbed-block pre,
  .md-typeset .tabbed-block pre>code {
    border: none !important;
    border-radius: 0 !important;
    margin: 0 !important; /* beats the margin-bottom !important of the code blocks above */
    box-shadow: none;
  }

  .md-typeset :not(pre)>code {
    font-size: 0.76em;
    padding: 0.08em 0.3em;
  }

  /* Neutralize tabbed labels negative margins on mobile */
  .md-typeset .tabbed-set {
    margin: 0.55rem 0;
    max-width: 100%;
    width: 100%;
  }

  .md-content__inner>.tabbed-set .tabbed-labels,
  .md-typeset .tabbed-labels {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0 !important;
    padding-right: 0;
    font-size: 0.7rem;
    max-width: 100%;
    width: 100%;
  }

  .md-content__inner>.tabbed-set .tabbed-labels~.tabbed-control--prev,
  .md-content__inner>.tabbed-set .tabbed-labels~.tabbed-control--next {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .md-typeset .tabbed-labels>label {
    padding: 0.3rem 0.55rem;
  }

  /* Arithmatex / math blocks on mobile */
  .md-typeset div.arithmatex {
    margin-left: 0;
    margin-right: 0;
    max-width: 100%;
    overflow-x: auto;
  }

  /* 5. Reduce tables and matrix chips size */
  .md-typeset__scrollwrap {
    margin: 0.45rem 0 !important;
  }

  .md-typeset table:not([class]) {
    font-size: 0.66rem;
  }

  .md-typeset table:not([class]) th {
    padding: 0.3rem 0.35rem;
    font-size: 0.66rem;
  }

  .md-typeset table:not([class]) td {
    padding: 0.25rem 0.3rem !important;
    font-size: 0.66rem;
  }

  .md-typeset table td:has(.twemoji) {
    padding: 0.18rem 0.2rem !important;
  }

  .md-typeset table td>span:has(.twemoji) {
    min-width: 18px !important;
    height: 16px !important;
    padding: 0 2px !important;
    border-radius: 4px !important;
  }

  .md-typeset table td .twemoji svg {
    width: 9px !important;
    height: 9px !important;
  }

  /* 6. Landing Page Hero on Mobile */
  .mipp-hero {
    padding: 1.2rem 0.25rem 0.8rem 0.25rem;
  }

  .mipp-hero-title {
    font-size: 1.75rem;
    line-height: 1.15;
    letter-spacing: -0.02em !important;
    margin-bottom: 0.5rem;
  }

  .mipp-hero-subtitle {
    font-size: 0.88rem;
    line-height: 1.4;
  }

  .mipp-chips-container {
    gap: 0.35rem;
  }

  .mipp-chip {
    font-size: 0.72rem;
    padding: 0.2rem 0.55rem;
  }

  .mipp-home-grid {
    margin: 1.25rem 0;
    gap: 0.85rem;
    grid-template-columns: 1fr;
  }

  .mipp-home-card {
    padding: 1.1rem;
  }

}